package br.senai.util;

import java.sql.Connection;
import java.sql.DriverManager;

public class Conexao {
	private Connection conn;

	public static Connection getConnection() {
		try {
			// Class.forName("com.mysql.jdbc.Driver").newInstance();
			// return
			// DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/avaliacao02",
			// "root", "root");
			Class.forName("org.postgresql.Driver");
			return DriverManager.getConnection(
					"jdbc:postgresql://localhost/postgres", "postgres", "dev");
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}

	public void fecharConexao() {
		try {
			conn.close();
		} catch (Exception e) {
			e.printStackTrace();

		}

	}

	public Connection getConn() {
		return conn;
	}
}
